<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/static/common/inner-header.jspf"%>
<title>开始考试</title>
<style>
body{
	margin:0px;
	padding:0px;
	background: lightgray;
}
#foreignBox{
	width:80%;
	padding:50px 30px;
	background: white;
	margin:0 auto;
}
.title{
	font-family: 微软雅黑;
	text-align: center;
}
.title span{
	text-decoration:underline;
}
#time{
	width:240px;
	height:30px;
	font-size:25px;
	background:white;
	font-weight:微软雅黑;
	position: fixed;
	top:30px;
	right:13%;
}
.answer{
	margin-left: 20px;
}
.question{
	margin-left:10px;
}
#submit{
	font-size:20px;
	position: fixed;
	color:green;
	top:60px;
	right:15%;
	cursor: pointer;
}

</style>
<script>
/**
 * 格式化时间
 */
var checkTime = function(num){
	if(num<10){
		return "0"+num;
	}else{
		return num;
	}
	
}
$(function(){
	var totalSeconds=${testPaperEntity.totalMinutes*60};
	var hours=0;
	var minutes=0;
	var seconds=0;
	/**
	* 时间的改变
	*/
	setInterval(function(){
		hours=Math.floor(totalSeconds/3600);
		minutes=Math.floor((totalSeconds%3600)/60);
		seconds=totalSeconds%60;
		$("#time").html("剩余时间:<span id = 'showTime'>"+checkTime(hours)+":"+checkTime(minutes)+":"+checkTime(seconds)+"</span>");
		totalSeconds--;
		if(totalSeconds>=3600){
			$("#showTime").css("color","green");
		}else if(totalSeconds>=1200){
			$("#showTime").css("color","#FF8C00");
		}else if(totalSeconds>0){
			$("#showTime").css("color","red");
		}else{
			
		}
	}, 1000);
	/**
	* 提交表单
	*/
	$($("#submit").bind("click",function(){
		$("#myform").submit();
	}));
});
</script>
</head>
<body>
	<div id="time"></div>
	<button id="submit" title="点击提交">提交试卷</button>
	<div id="foreignBox">
		<h2 class="title">2016-2017年度${testPaperEntity.name }${testPaperEntity.paperTypeStr }</h2>
		<h4 class="title">班级:<span>${sessionScope.user.className }班</span>　　姓名:<span>${sessionScope.user.name }</span>　　总分:<span>${testPaperEntity.totalPoint}</span>　得分:<span>　　　　</span></h4>
		<form id="myform" action="${pageContext.request.contextPath}/stu/GoingExamServlet?command=endExam&paperId=${testPaperEntity.id}" method="post">
		<br><h4>一、单选题（共${testPaperEntity.singleOptionNumber }题，每题${testPaperEntity.singleOptionEachPoint }分，共${testPaperEntity.singleOptionEachPoint*testPaperEntity.singleOptionNumber }分）。</h4>
		<c:forEach items="${choiceQuestions }" var="choiceQuestion" varStatus="v">
			<input type="hidden"  value="${choiceQuestion.id  }"  name="choices${v.count }"/>
			<span class="question">${v.count }、${choiceQuestion.question }</span><br/>
			<input class="answer" type="radio" id="a${choiceQuestion.id }" name="choiceAnswer${choiceQuestion.id }" value="A" ><label for="a${choiceQuestion.id }">A.${choiceQuestion.answer_a }</label><br>
			<input class="answer" type="radio" id="b${choiceQuestion.id }" name="choiceAnswer${choiceQuestion.id }" value="B" ><label for="a${choiceQuestion.id }">B.${choiceQuestion.answer_b }</label><br>
			<input class="answer" type="radio" id="c${choiceQuestion.id }" name="choiceAnswer${choiceQuestion.id }" value="C" ><label for="a${choiceQuestion.id }">C.${choiceQuestion.answer_c }</label><br>
			<input class="answer" type="radio" id="d${choiceQuestion.id }" name="choiceAnswer${choiceQuestion.id }" value="D" ><label for="a${choiceQuestion.id }">D.${choiceQuestion.answer_d }</label><br><br>
		</c:forEach>
		
		<h4>二、多选题（共${testPaperEntity.multiOptionNumber }题，每题${testPaperEntity.multiOptionEachPoint }分，共${testPaperEntity.multiOptionEachPoint*testPaperEntity.multiOptionNumber }分）。</h4>
		<c:forEach items="${multiQuestions }" var="multiQuestion" varStatus="v">
			<input type="hidden"  value="${multiQuestion.id  }"  name="multi${v.count }"/>
			<span class="question">${v.count }、${multiQuestion.question }</span><br/>
			<input class="answer" type="checkbox" id="a${multiQuestion.id }" name="multiAnswer${multiQuestion.id }" value="A" ><label for="a${multiQuestion.id }">A.${multiQuestion.answer_a }</label><br>
			<input class="answer" type="checkbox" id="b${multiQuestion.id }" name="multiAnswer${multiQuestion.id }" value="B" ><label for="a${multiQuestion.id }">B.${multiQuestion.answer_b }</label><br>
			<input class="answer" type="checkbox" id="c${multiQuestion.id }" name="multiAnswer${multiQuestion.id }" value="C" ><label for="a${multiQuestion.id }">C.${multiQuestion.answer_c }</label><br>
			<input class="answer" type="checkbox" id="d${multiQuestion.id }" name="multiAnswer${multiQuestion.id }" value="D" ><label for="a${multiQuestion.id }">D.${multiQuestion.answer_d }</label><br><br>
		</c:forEach>
		
		<h4>三、判断题（共${testPaperEntity.judgeNumber }题，每题${testPaperEntity.judgeEachPoint }分，共${testPaperEntity.judgeNumber*testPaperEntity.judgeEachPoint }分）。</h4>
		<c:forEach items="${judgeQuestions }" var="judgeQuestion" varStatus="v">
			<input type="hidden"  value="${judgeQuestion.id  }"  name="judge${v.count }">
			<span class="question">${v.count }、${judgeQuestion.question }</span><br/>
			<input class="answer" type="radio" id="is${judgeQuestion.id }" value="1" name="judgeAnswer${judgeQuestion.id }"><label for="is${judgeQuestion.id }">对</label>&nbsp;&nbsp;
			<input class="answer" type="radio" id="no${judgeQuestion.id }" value="2"  name="judgeAnswer${judgeQuestion.id }"><label for="no${judgeQuestion.id }">错</label><br><br>
		</c:forEach>
		<br><br><br><br><br><br><br><br><br>
		</form>
	</div>
</body>
</html>